Skip to content

Remove references to torchao's AffineQuantizedTensor#13405

Merged
sayakpaul merged 2 commits intohuggingface:mainfrom
andrewor14:remove-aqt
Apr 6, 2026
Merged

Remove references to torchao's AffineQuantizedTensor#13405
sayakpaul merged 2 commits intohuggingface:mainfrom
andrewor14:remove-aqt

Conversation

@andrewor14
Copy link
Copy Markdown
Contributor

Summary: TorchAO recently deprecated AffineQuantizedTensor and related classes (pytorch/ao#2752). These will be removed in the next release. We should remove references of these classes in diffusers before then.

Test Plan:
python -m pytest -s -v tests/quantization/torchao/test_torchao.py

**Summary:** TorchAO recently deprecated AffineQuantizedTensor
and related classes (pytorch/ao#2752).
These will be removed in the next release. We should remove
references of these classes in diffusers before then.

**Test Plan:**
python -m pytest -s -v tests/quantization/torchao/test_torchao.py
@andrewor14
Copy link
Copy Markdown
Contributor Author

Hi @sayakpaul can you help review this?

Comment on lines 136 to 142
def _linear_extra_repr(self):
weight = _quantization_type(self.weight)
from torchao.utils import TorchAOBaseTensor

weight = self.weight.__class__.__name__ if isinstance(self.weight, TorchAOBaseTensor) else None
if weight is None:
return f"in_features={self.weight.shape[1]}, out_features={self.weight.shape[0]}, weight=None"
else:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah should be, all new tensor subclasses are TorchAOBaseTensor

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems OK to make this function public as well

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul sayakpaul merged commit 24b4c25 into huggingface:main Apr 6, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants